package io.github.tangwan.jvm;

/**
 * 测试动态加载
 * @author tangwan
 * @version V1.0
 * created on 2021/9/16 17:06
 * @since JDK 1.8
 */
public class TestDynamicLoad {

    static {
        System.out.println("**********load TestDynamicLoad****************");
    }

    public static void main(String[] args) {
        new A();
        System.out.println("*************load test**************");
        //B不会加载,new B时才会加载
        //B b = null;
    }

}

class A{

    static {
        System.out.println("**********load A**************");
    }

    public A(){
        System.out.println("*********initial A*************");
    }

}

class B{

    static {
        System.out.println("**********load B**************");
    }

    public B(){
        System.out.println("*********initial B*************");
    }

}
